package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.pojos.ApUser;
import com.heima.user.service.ApUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

@Api(value = "app端用户管理api",tags = "app端用户管理api")
@RestController
@RequestMapping("/api/v1")
public class ApUserController {
    @Autowired
    private ApUserService apUserService;
    @ApiOperation("根据id查询apUser信息")
    @GetMapping("/user/{id}")
    public ResponseResult<ApUser> findUserById(@PathVariable("id") Integer id) {
        return ResponseResult.okResult(apUserService.getById(id));
    }
    @ApiOperation("批量导入APP用户信息")
    @PostMapping("/apex/import")
    public ResponseResult importUser(MultipartFile file)throws IOException {
        return apUserService.importUser(file);
    }
    @ApiOperation("下载重复的APP用户信息")
    @GetMapping("/apex/export")
    public void exportUser(String repetitionId) {
        apUserService.exportUser(repetitionId);
    }
}